<div class="SipeiMain_r fr">
      <h2 class="clearfix fonts_18 height45 fontc_444"><?php echo $this->title;?></h2>
	   <?php
	   $form = $this->beginWidget('CActiveForm', array(
	   'action' => Yii::app()->createUrl($this->route),
	   'method' => 'POST',
	   'id' => 'searchForm'));
		?>
      <ul class="clearfix back_bgf border_3 border_c pr30 pl30 pt20 pb20 height32 fontc_666">
        <li class="fl pt10 pr30 pb10">
		代码：<input type="text" name="code" value="<?php echo $serch['code']; ?>" class="pt6 pr9 pb6 pl9 border_3 border_c fontc_666 w100" />
		</li>
        <li class="fl pt10 pr30 pb10">
		规则名称：<input type="text" name="name" value="<?php echo $serch['name']; ?>" class="pt6 pr9 pb6 pl9 border_3 border_c fontc_666 w100" />
		</li>
        <li class="fl pt10 pr30 pb10">
		<span class="fl pr8">是否生效</span><input type="checkbox" name="status"  class="fl mt9" <?php echo $serch['status'] == 1 ? 'checked=checked' : '';?>/>
		</li>
        <li class="fr pt10 pb10">
		<input type="submit" value="查询" class="b_a_n border_3 back_bgfb w80 height32 fontc_FFF fonts_12" />
		</li>
      </ul>
	 <?php
	 $this->endWidget();
	?>
      <div class="clearfix back_bgf border_c mt15 pt20 pb20">
        <div class="clearfix pb20 pl30"><input type="button" value="新增" onclick="add();" class="b_a_n border_3 back_bgfb w80 height32 fontc_FFF fonts_12" /></div>
          <table class="height40">
            <thead class="back_bgf5 fontc_666">
              <tr>
                <th width="100" align="center" class="m_hr_t m_hr_b">代码</th>
                <th width="200" align="center" class="m_hr_t m_hr_b">规则名称</th>
                <th width="90" align="center" class="m_hr_t m_hr_b">是否生效</th>
                <th width="260" align="left" class="m_hr_t m_hr_b pl20">备注</th>
                <th width="148" align="center" class="m_hr_t m_hr_b">操作</th>
              </tr>
            </thead>
            <tbody class="fontc_444">
			<?php if(!empty($data)): ?>
				<?php foreach($data as $value):?>
              <tr>
                <td align="center" class="m_hr_b pr5 pl5"><?php echo $value['code']; ?></td>
                <td align="center" class="m_hr_b"><?php echo $value['name']; ?></td>
               	<td align="center" class="m_hr_b"><input type="checkbox" disabled='' <?php echo $value['status'] == 1 ? 'checked=checked' : '';?> /></td>
                <td align="left" class="m_hr_b pl20"><?php echo $value['remark']; ?></td>
                <td align="center" class="m_hr_b">
                    <a href="<?php echo $this->createUrl('/import_rule/detail/index')?>?id=<?php echo $value['id']; ?>" class="pr15" title="规则字段设置"><img src="/themes/default/images/Sipei/plus.png"/></a>
                    <img src="/themes/default/images/Sipei/edit.png" title="编辑" class="pr15" onclick="update(<?php echo $value['id']; ?>)" />
                    <img src="/themes/default/images/Sipei/delate.png" title="删除" onclick="set_ok(<?php echo $value['id']; ?>)" />
                </td>
              </tr>
              <?php endforeach;?>
			  <?php else: ?>
              <tr>
                <td colspan="5"><h1 align="center">暂无数据</h1></td>
              </tr>
			  <?php endif; ?>
            </tbody>
          </table>
          <?php $this->renderPartial('//partial/partial_pager', array('pages' => $pages,"url"=>$pageUrl)); ?>
      </div>
    </div>
	
<script>
function set_ok(id) {
	if(confirm("确定要删除此数据")){
		location.href="<?php echo $this->createUrl("delete")?>/id/"+id;
	}else{
		return false;
	}
}
function add() {
	api = $.dialog({
		id: 'testID2',
		lock: true,
		padding:0,
		fixed: true,
		title:"新增",
		width:500,
		height:640,
		max: false,
		min: false
	});
	$.get('/import_rule/default/add',function(html){
		api.content(html);
	});
}
function update(id) {
	api = $.dialog({
		id: 'testID2',
		lock: true,
		padding:0,
		fixed: true,
		title:"编辑",
		width:500,
		height:640,
		max: false,
		min: false
	});
	$.post('/import_rule/default/update',{id:id,time:new Date()},function(html){
		api.content(html);
	});
}

</script>